<?php

use Illuminate\Database\Migrations\Migration;

class NewsUpdate extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        Schema::table("news", function($table)
        {
            $table->dropColumn("feature_image");
        });

        Schema::create("news_images", function($table)
        {
            $table->increments("id");
            $table->text("imagefilename");

            // soft deletes
            $table->softDeletes();

            // timestamps
            $table->timestamps();
        });
        //
        Schema::create("news_news_images", function($table)
        {
            $table->increments("id");
            $table->integer("newsid");
            $table->integer("imageid");

            // soft deletes
            $table->softDeletes();

            // timestamps
            $table->timestamps();
        });
    }

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
        Schema::drop("news_images");
        Schema::drop("news_news_images");

        Schema::table('news', function($table)
        {
            $table->string('feature_image');
        });

	}

}